package cn.wangxl.loglog.constants;

import org.springframework.util.StringUtils;

import java.util.Objects;

/**
 * @Deacription TODO
 * @Author 20112128
 * @Date 2020/5/1 1:43
 **/
public class MongoNameUtil {

    /**
     * 查询MongoDatabase collection name
     * 使用应用名称作为mongodb collection name
     * @param application
     * @return
     */
    public static String getMongoCollectionName(Application application,String suffixCollectionName){
        Objects.requireNonNull(application);
        if(StringUtils.isEmpty(suffixCollectionName)){
            throw new RuntimeException("参数为空");
        }
        return application.appName+":"+suffixCollectionName.toLowerCase();
    }
}
